<template>
  <div class="cardBody">
    <div class="cardBodyItem wow fadeInDown" :data-wow-delay="index*0.3+'s'" v-for="(item,index) in list" :key="index">
      <div class="num">
        <dome :number="item.num"></dome>
        <!--<dome :number="item.num"></dome>-->
      </div>
      <pedestal :skin="'skin'+(index+1)"></pedestal>
      <div class="title">
        {{ item.title }}
        <span style="font-size: 11px;" v-if="item.other">
          ({{item.other}})
        </span>
      </div>
    </div>
    <!--<pops ref="pop" @confirm="getShowDetail"></pops>-->
  </div>
</template>

<script>
import gsapNum from '@/components/gsapNum/index.vue'
import pedestal from './pedestal.vue'
import dome from './dome.vue'
import { monChampion, yearChampion} from '@/api/home.js'
import pops from '@/views/components/pop/pops'

export default {
  name: 'item1Title',
  components: {gsapNum, pedestal, dome, pops},
  props: {
    objParent: {
      type: [Object, Array]
    },
  },
  data() {
    return {
      list: [
        {title:'本月销售冠军',num:''},{title:'年销售冠军',num:'',other:'截至本月'}
      ],
      obj1: '',
      obj2: '',
      obj3: '',
      obj4: '',
      obj5: ''
    }
  },

  async mounted() {
    await this.getDataList()
  },
  methods: {
    clickItem(item) {
      console.log(item)
      this.$refs.pop.getShow(item)
    },
    getShowDetail() {
      console.log(111)
    },
    async getDataList() {
      await monChampion().then(res=>{
        if(res.code == 200){
          this.list[0].num = res.data.saleName
        }
      }).catch(err=>{
        console.log(err)
      })
      await yearChampion().then(res=>{
        if(res.code == 200){
          this.list[1].num = res.data.saleName
        }
      }).catch(err=>{
        console.log(err)
      })
      /*this.$nextTick(()=>{
        this.list.forEach(item=>{
          item.num = `${item.saleName}：${item.saleMoney.toLocaleString()}`
        })
      })*/
    },
    // showPops(item){
    //   console.log(item)
    //   this.$refs.pop.getShow(item)
    // },
  }
}
</script>

<style lang="scss" scoped>
.cardBody {
  position: relative;
  width: calc(100% - 0px);
  margin: 0 auto;
  height: 100%;
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex-wrap: nowrap;
  flex-direction: row;
  align-content: flex-start;

  .cardBodyItem {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    flex-direction: column;
    align-content: flex-start;
    width: 46%;
    height: calc(100% - 30px);
    background: linear-gradient(360deg, rgba(0, 81, 155, 0.14) 0%, rgba(0, 89, 154, 0.04) 100%);
    box-shadow: inset 0px 0px 68px 0px rgba(0, 133, 255, 0.15);
    border-radius: 0px 0px 0px 0px;
    opacity: 1;
    border: 1px solid rgba(0, 133, 255, 0.06);

    .title {
      font-size: 20px;
      font-family: PingFang SC, PingFang SC;
      font-weight: 500;
      color: #FFFFFF;
      //cursor: pointer;
      //margin-bottom: 10px;
    }

    .num {
      display: flex;
      justify-content: center;
      align-items: center;
      flex-wrap: nowrap;
      flex-direction: row;
      align-content: flex-start;
      position: relative;
      z-index: 1;
      .real-time-num {
        width: auto !important;
        font-size: 30px;
        font-family: DIN-Bold, DIN;
        font-weight: bold;
        color: #31FFFD;
      }
    }

    :deep(.num) {
      .gsapNum {
        font-size: 36px;
        font-family: YouSheBiaoTiHei, YouSheBiaoTiHei;
        font-weight: 400;
        line-height: 33px;
        background: linear-gradient(180deg, #FFFFFF 0%, #00FFFF 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
      }
    }
  }

  .cardBodyItem:nth-child(2) {
    :deep(.num) {
      .gsapNum {
        background: linear-gradient(180deg, #FFFFFF 0%, #60FF8C 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
      }
    }
  }

  .cardBodyItem:nth-child(3) {
    :deep(.num) {
      .gsapNum {
        background: linear-gradient(180deg, #FFFFFC 0%, #FFEE58 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
      }
    }
  }
}
</style>
